/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jpa.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author JAVA
 */
@Entity
@Table(name = "advForProvider")
@NamedQueries({
    @NamedQuery(name = "AdvForProvider.findAll", query = "SELECT a FROM AdvForProvider a"),
    @NamedQuery(name = "AdvForProvider.findById", query = "SELECT a FROM AdvForProvider a WHERE a.id = :id"),
    @NamedQuery(name = "AdvForProvider.findByName", query = "SELECT a FROM AdvForProvider a WHERE a.name = :name"),
    @NamedQuery(name = "AdvForProvider.findByEmail", query = "SELECT a FROM AdvForProvider a WHERE a.email = :email"),
    @NamedQuery(name = "AdvForProvider.findByPhone", query = "SELECT a FROM AdvForProvider a WHERE a.phone = :phone"),
    @NamedQuery(name = "AdvForProvider.findByAddress", query = "SELECT a FROM AdvForProvider a WHERE a.address = :address"),
    @NamedQuery(name = "AdvForProvider.findByIsApprove", query = "SELECT a FROM AdvForProvider a WHERE a.isApprove = :isApprove"),
    @NamedQuery(name = "AddAdvForProvider",query="INSERT INTO AdvForProvider values (:id,:name,:email,:phone,:address,:operationField,:service,:isApprove,:userName")})

public class AdvForProvider implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Column(name = "email")
    private String email;
    @Basic(optional = false)
    @Column(name = "phone")
    private String phone;
    @Basic(optional = false)
    @Column(name = "address")
    private String address;
    @Basic(optional = false)
    @Lob
    @Column(name = "operationField")
    private String operationField;
    @Basic(optional = false)
    @Lob
    @Column(name = "service")
    private String service;
    @Basic(optional = false)
    @Column(name = "isApprove")
    private int isApprove;
    @JoinColumn(name = "userName", referencedColumnName = "userName")
    @ManyToOne
    private User user;

    public AdvForProvider() {
    }

    public AdvForProvider(Integer id) {
        this.id = id;
    }

    public AdvForProvider(Integer id, String name, String email, String phone, String address, String operationField, String service, int isApprove) {
        this.id = id;
        this.name = name;
        this.email = email;
        this.phone = phone;
        this.address = address;
        this.operationField = operationField;
        this.service = service;
        this.isApprove = isApprove;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getOperationField() {
        return operationField;
    }

    public void setOperationField(String operationField) {
        this.operationField = operationField;
    }

    public String getService() {
        return service;
    }

    public void setService(String service) {
        this.service = service;
    }

    public int getIsApprove() {
        return isApprove;
    }

    public void setIsApprove(int isApprove) {
        this.isApprove = isApprove;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AdvForProvider)) {
            return false;
        }
        AdvForProvider other = (AdvForProvider) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.entities.AdvForProvider[id=" + id + "]";
    }

}
